package cn.chencaiju.day11;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import org.junit.Test;

public class FileReaderTest {
	/*
	 * 只能使用默认的编码格式读取数据
	 */
	@Test public void testFileReader() {
		File file=new File(InputStreamReaderTest.path);
		try(FileReader reader=new FileReader(file)) {
			
			char[] cbuf = new char[100];
			int count=reader.read(cbuf);
			System.out.println(new String(cbuf,0,count));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
}
